package com.xinxin.leetcode.problem409;

import com.sun.xml.internal.ws.util.StringUtils;

/**
 * @author ShiXinXin
 * @date 2019-12-16 1:26
 */
public class Solution {
    public int longestPalindrome(String s) {
        int[] arr = new int[128];
        int count = 0;
        for (char ch : s.toCharArray()) {
            if (++arr[ch] == 2) {
                count += 2;
                arr[ch] = 0;
            }
        }
        return count == s.length() ? count : count + 1;
    }

    public static void main(String[] args) {
        System.out.println(new Solution().longestPalindrome("aabbccccdd"));
    }
}
